package com.ruoyi.web.controller.demo.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/abc")
public class AbcController {
    Logger logger = LoggerFactory.getLogger(getClass());
    @NacosValue(value = "${super.user}", autoRefreshed = true)
    private String superUser;

    @RequestMapping(value = "/test_get", method = RequestMethod.GET)
    @ResponseBody
    public String get() {
        return superUser;
    }

    @RequestMapping(value = "/test_post_json", method = RequestMethod.POST)
    @ResponseBody
    public SysUser testjson(@RequestBody SysUser sysUser, @RequestParam(name = "appKey",required = true) String appKey, String accessToken) {
        logger.info("sysUser:{},appKey:{},accessToken:{}",sysUser.toString(),appKey,accessToken);
        return sysUser;
    }
    @RequestMapping(value = "/test_get_form", method = RequestMethod.GET)
    @ResponseBody
    public SysUser testGetform(SysUser sysUser, @RequestParam(name = "appKey",required = true) String appKey, String accessToken) {
        logger.info("sysUser:{},appKey:{},accessToken:{}",sysUser.toString(),appKey,accessToken);
        return sysUser;
    }
    @RequestMapping(value = "/test_post_form", method = RequestMethod.POST)
    @ResponseBody
    public SysUser testPostform(SysUser sysUser, @RequestParam(name = "appKey",required = true) String appKey, String accessToken) {
        logger.info("sysUser:{},appKey:{},accessToken:{}",sysUser.toString(),appKey,accessToken);
        return sysUser;
    }
}